function placeMapMarkers($pageId, $DB_SERVER, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE) { global $baseURL; $results = getMapMarkers($pageId, $DB_SERVER, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE); //$numRows = mysqli_num_rows($results); $numRows = count($results); $counter = 0; $markerJS = ''; if ($numRows > 0) { $markerJS .= 'var iconBase = \'' . $baseURL . '/img/\';'; $markerJS .= "\r\n"; $markerJS .= 'var thmbBase = \'' . $baseURL . '/img/locations/thumbnails/\';'; $markerJS .= "\r\n"; $markerJS .= 'var markerLocations = ['; $markerJS .= "\r\n"; foreach ($results as $row) { $counter++; $markerJS .= '{'; $markerJS .= "\r\n"; $markerJS .= 'id: ' . $row['id'] . ', '; $markerJS .= "\r\n"; $markerJS .= 'title: "' . $row['title'] . '", '; $markerJS .= "\r\n"; $markerJS .= 'lat: ' . $row['lat'] . ', '; $markerJS .= "\r\n"; $markerJS .= 'lng: ' . $row['lng'] . ', '; $markerJS .= "\r\n"; $markerJS .= 'icon: iconBase + \'' . $row['map_icon'] . '\', '; $markerJS .= "\r\n"; $markerJS .= 'image_thumb: thmbBase + \'' . $row['image_thumb'] . '\', '; $markerJS .= "\r\n"; $markerJS .= 'alt: "' . $row['alt'] . '", '; $markerJS .= "\r\n"; $markerJS .= 'category: "' . $row['category_title'] . '", '; $markerJS .= "\r\n"; $markerJS .= 'sub_heading: "' . $row['type_title'] . '"'; $markerJS .= "\r\n"; $markerJS .= '}'; if ($counter < $numRows) { $markerJS .= ','; } $markerJS .= "\r\n"; } $markerJS .= '];'; $markerJS .= "\r\n"; $markerJS .= "\r\n"; } echo $markerJS; }
function getFilters($pageId, $DB_SERVER, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE) { $filterArray = array(); $categories = getMapMarkers($pageId, $DB_SERVER, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE); foreach ($categories as $category) { if (!in_array($category['category_title'], $filterArray)) { array_push($filterArray, $category['category_title']); } } return $filterArray; }