Hi I have a table as name reports with addresses and a field as name "status" In the field Status I can choose Open or Closed.
On the list page of reports the Open Street Maps works fine but what I want is that if I choose "Closed" in the "status" field, a red.png marker appears on the map. If I choose "Open" a green.png marker should appear.
I uploaded two image file in the rood of my project "red.png and green.png"
THis is my coding in the Map on the list page. Please advice.
// Longitude and latitude or address field should be specified
// name of field in table that used as address for map
$mapSettings["addressField"] = "adres";
// name of field in table that used as latitude for map
$mapSettings["latField"] = "Latitude";
// name of field in table that used as longitude for map
$mapSettings["lngField"] = "Longitude";
// You can specify a custom marker icon.
// Enter either a file name for all markers:
// $mapSettings["markerIcon"] = "images/Smile.png";
// Or specify a field from your SQL query that contains marker name:
// $mapSettings["markerField"] = "map_icon";
// The query field should contain a path tho the image file
// Leave both fields blank to use default marker.
// HERE IS MY CODING //
if ($data["status"] == CLOSED) {
$mapSettings["markerIcon"] = "red.png";
$mapSettings["markerField"] = "";
} else if ($data["status"] == OPEN) {
$mapSettings["markerIcon"] = "green.png";
$mapSettings["markerField"] = "";
}
// END OF MY CODING //
// width of map in px
$mapSettings["width"] = 1200;
// height of map in px
$mapSettings["height"] = 450;
$mapSettings['description'] = 'omschrijving'; // a field that contains the marker description
// uncomment the next line if you need a fixed zoom for your map. Valid values are 1-20
//$mapSettings['zoom'] = 10;
// Google maps only.
// Make the markers join in clusters when zoom is wide.
// This feature works only with markers with coordinates specified.
//$mapSettings['clustering'] = true;
// Google maps only.
// Display markers in a form of a heat map.
// This feature works only with markers with coordinates specified.
//$mapSettings['heatMap'] = true;
// Uncomment the next line to make map markers lead to Edit pages.
// By default clicks on markers open View pages.
// $mapSettings["markerAsEditLink"] = true;
// Display Center map link in the address field
// 1 - display center link near the address
// 2 - center map when clicking on the address itself
//$mapSettings['showCenterLink'] = 1;
// Center Link text
// $mapSettings['centerLinkText'] = 'Center';
DisplayMap($mapSettings);