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 $bSimpleQuery = !empty($aMoreParams['q']);
19 $bStructuredQuery = !$bSimpleQuery
20 && !(empty($aMoreParams['street'])
21 && empty($aMoreParams['city'])
22 && empty($aMoreParams['county'])
23 && empty($aMoreParams['state'])
24 && empty($aMoreParams['country'])
25 && empty($aMoreParams['postalcode']));
27 <div class="radio-inline">
28 <input type="radio" name="query-selector" id="simple" value="simple" <?php if ($bSimpleQuery) { echo 'checked="checked"'; } ?> >
29 <label for="simple">simple</label>
31 <div class="radio-inline">
32 <input type="radio" name="query-selector" id="structured" value="structured" <?php if ($bStructuredQuery) { echo 'checked="checked"'; } ?> >
33 <label for="structured">structured</label>
36 <form role="search" accept-charset="UTF-8" action="<?php echo CONST_Website_BaseURL; ?>search.php">
37 <div class="form-group-simple"
40 echo 'style="display:none;"';
43 <input id="q" name="q" type="text" class="form-control input-sm" placeholder="Search" value="<?php echo htmlspecialchars($aMoreParams['q'] ?? ''); ?>" >
45 <div class="form-group-structured"
47 if (!$bStructuredQuery) {
48 echo "style='display:none;'";
51 <div class="form-inline">
52 <input id="street" name="street" type="text" class="form-control input-sm" placeholder="House number/Street" value="<?php echo htmlspecialchars($aMoreParams['street'] ?? ''); ?>" >
53 <input id="city" name="city" type="text" class="form-control input-sm" placeholder="City" value="<?php echo htmlspecialchars($aMoreParams['city'] ?? ''); ?>" >
54 <input id="county" name="county" type="text" class="form-control input-sm" placeholder="County" value="<?php echo htmlspecialchars($aMoreParams['county'] ?? ''); ?>" >
55 <input id="state" name="state" type="text" class="form-control input-sm" placeholder="State" value="<?php echo htmlspecialchars($aMoreParams['state'] ?? ''); ?>" >
56 <input id="country" name="country" type="text" class="form-control input-sm" placeholder="Country" value="<?php echo htmlspecialchars($aMoreParams['country'] ?? ''); ?>" >
57 <input id="postalcode" name="postalcode" type="text" class="form-control input-sm" placeholder="Postal Code" value="<?php echo htmlspecialchars($aMoreParams['postalcode'] ?? ''); ?>" >
59 <div class="form-group search-button-group">
60 <button type="submit" class="btn btn-primary btn-sm">Search</button>
61 <?php if (CONST_Search_AreaPolygons) { ?>
62 <input type="hidden" value="1" name="polygon_geojson" />
64 <input type="hidden" name="viewbox" value="<?php echo htmlspecialchars($aMoreParams['viewbox'] ?? ''); ?>" />
65 <div class="checkbox-inline">
66 <input type="checkbox" id="use_viewbox" <?php if (!empty($aMoreParams['viewbox'])) echo "checked='checked'"; ?>>
67 <label for="use_viewbox">apply viewbox</label>
75 <?php if ($sQuery) { ?>
77 <div id="searchresults" class="sidebar">
80 foreach($aSearchResults as $iResNum => $aResult)
83 echo '<div class="result" data-position=' . $i . '>';
85 echo (isset($aResult['icon'])?'<img alt="icon" src="'.$aResult['icon'].'"/>':'');
86 echo ' <span class="name">'.htmlspecialchars($aResult['name']).'</span>';
87 // echo ' <span class="latlon">'.round($aResult['lat'],3).','.round($aResult['lon'],3).'</span>';
88 // echo ' <span class="place_id">'.$aResult['place_id'].'</span>';
89 if (isset($aResult['label']))
90 echo ' <span class="type">('.$aResult['label'].')</span>';
91 else if ($aResult['type'] == 'yes')
92 echo ' <span class="type">('.ucwords(str_replace('_',' ',$aResult['class'])).')</span>';
94 echo ' <span class="type">('.ucwords(str_replace('_',' ',$aResult['type'])).')</span>';
95 echo detailsPermaLink($aResult, 'details', 'class="btn btn-default btn-xs details"');
99 if (!empty($aSearchResults) && $sMoreURL)
101 echo '<div class="more"><a class="btn btn-primary" href="'.htmlentities($sMoreURL).'">Search for more results</a></div>';
105 echo '<div class="noresults">No search results found</div>';
113 <div id="intro" class="sidebar">
114 <?php include(CONST_BasePath.'/lib/template/includes/introduction.php'); ?>
119 <div id="map-wrapper">
120 <div id="map-position">
121 <div id="map-position-inner"></div>
122 <div id="map-position-close"><a href="#">hide</a></div>
127 </div> <!-- /content -->
131 <script type="text/javascript">
134 $aNominatimMapInit = array(
135 'zoom' => CONST_Default_Zoom,
136 'lat' => CONST_Default_Lat,
137 'lon' => CONST_Default_Lon,
138 'tile_url' => CONST_Map_Tile_URL,
139 'tile_attribution' => CONST_Map_Tile_Attribution
141 echo 'var nominatim_map_init = ' . json_encode($aNominatimMapInit, JSON_PRETTY_PRINT) . ';';
143 echo 'var nominatim_results = ' . json_encode($aSearchResults, JSON_PRETTY_PRINT) . ';';
146 <?php include(CONST_BasePath.'/lib/template/includes/html-footer.php'); ?>