public function searchVenues($country, $criteria) { list($zips, $cities) = SearchAPI::zipCodeSearch($country, $criteria, 1); if (sizeof($zips) < 1) { # not a zip code search unset($zips); unset($cities); } else { $where = ""; foreach ($zip as $zip) { $where = sprintf("%s OR %s LIKE '%%%s%%'", $where, "address", $zip); } foreach ($cities as $city) { $where = sprintf("%s OR %s LIKE '%%%s%%'", $where, "address", $city); } } $query = $this->db()->query(sprintf("SELECT * FROM Place WHERE name LIKE '%s' OR address LIKE '%s' %s AND pending = 0;", "%" . $criteria . "%", "%" . $criteria . "%", $where)); $results = $query->fetchAll(); return array("criteria" => $criteria, "country" => isset($country) ? $country : SearchAPI::getCountryFromIP(), "cities" => $cities, "results" => $results); }
public function getCountryList() { return new JsonResponse(array("countries" => SearchAPI::getCountries())); }