Bonjour, voici mon problème :

Je suis capable de faire afficher ceci avec des marker random.

Par contre j'aimerais pouvoir mettre le marqueur soit rouge ou soit vert selon une condition que je passerais en php.

Quelqu'un peut m'aider ?

Voici mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<?php
include "includes/header.php";
?>
            <div id="ss-container" class="ss-container">
<div id="map_canvas"> <!-- Map will display -->
			<div id="map"> <!-- Fullscreen Loading & Fullscreen Buttons area -->
				<span style="color:Gray;">Loading map...</span>			  </div> 
			<!-- Fullscreen Loading & Fullscreen Buttons area Ends -->
            </div><!-- Map Ends display -->
 
			<!-- Google Map JS -->
			<script type="text/javascript" src = "http://maps.google.com/maps/api/js?sensor=false">
</script>
<script type="text/javascript">
var locations = [
<?php 
$query="SELECT * from locations";
$result=mysql_query($query);
	{ 
	if ($num=mysql_numrows($result)) {
$i=0;
while ($i < $num) {
$id=mysql_result($result,$i,"idlocations");
$title=mysql_result($result,$i,"emplacement");
$lapt=mysql_result($result,$i,"latitude");
$long=mysql_result($result,$i,"longitude");
#$aimage=mysql_result($result,$i,"aimage");
#$categoryid=mysql_result($result,$i,"categoryid");
#$short_title=mysql_result($result,$i,"short_title");
 
 
$query1="SELECT * FROM testjournalier WHERE emplacement='$title'";
$result1=mysql_query($query1);
$dimension1=mysql_num_rows($result1);
// Si Action = rien, il affiche toute
for ($i1=0;$i1<$dimension1;$i1++) 
{
$tableau1=mysql_fetch_array($result1); 
// Mes les variables dans un Tableau
}
 
$query2="SELECT * FROM sqljournalier WHERE emplacement='$title'";
$result2=mysql_query($query2);
$dimension2=mysql_num_rows($result2);
// Si Action = rien, il affiche toute
for ($i2=0;$i2<$dimension2;$i2++) 
{
$tableau2=mysql_fetch_array($result2); 
// Mes les variables dans un Tableau
}
 
$query3="SELECT * FROM backupexec WHERE emplacement='$title'";
$result3=mysql_query($query3);
$dimension3=mysql_num_rows($result3);
// Si Action = rien, il affiche toute
for ($i3=0;$i3<$dimension3;$i3++) 
{
$tableau3=mysql_fetch_array($result3); 
// Mes les variables dans un Tableau
}
 
 
echo "['<div class=info><h4>".$title."</h4><br><h4>IPSentry</h4><b>Serveur:</b> ".$tableau1[3]."<br><b>Date: </b>".$tableau1[2]."<h4>Sql</h4><b>Status: </b>".$tableau2[2]."<br><b>Date: </b>".$tableau2[3]."<br><b>Serveur:</b>".$tableau2[4]."<h4>BackupExec</h4><b>Serveur:</b>".$tableau3[6]."<br><b>Status:</b>".$tableau3[1]."<br><b>Date Debut:</b>".$tableau3[2]."/".$tableau3[3]."<br><b>Date Fin:</b>".$tableau3[4]."/".$tableau3[5]."<br><b>Size:</b>".$tableau3[7]."<br><b>Rate:</b>".$tableau3[8]."<br><b>Type:</b>".$tableau3[10]."</div>', ".$lapt.", ".$long."],";
$i++;
 
 
 
}
}
else 
{
echo "<h3 align='center'><font color='#ff0000'>No Content Found</font></h3>";
}
}
?>
    ];
 
 
	// Setup the different icons and shadows
var iconURLPrefix = 'images/';
 
 
var icons = [  
iconURLPrefix + 'marker1.png',
iconURLPrefix + 'marker7.png'
]
 
    var icons_length = icons.length;
 
 
  var shadow = {
  anchor: new google.maps.Point(5,13),
  url: iconURLPrefix + 'msmarker.shadow.png'
  };
 
    var map = new google.maps.Map(document.getElementById('map'), {
      zoom: -5,
      center: new google.maps.LatLng(46.342792, -72.544803),
      mapTypeId: google.maps.MapTypeId.ROADMAP,
      mapTypeControl: false,
      streetViewControl: false,
	  disableDefaultUI: true,
      panControl: false,
      zoomControlOptions: {
      position: google.maps.ControlPosition.LEFT_BOTTOM
      }
    });
 
    var infowindow = new google.maps.InfoWindow({
      maxWidth: 400,
	  maxHeight: 350
    });
 
    var marker;
    var markers = new Array();
 
    var iconCounter = 0;
 
    // Add the markers and infowindows to the map
    for (var i = 0; i < locations.length; i++) {  
      marker = new google.maps.Marker({
        position: new google.maps.LatLng(locations[i][1], locations[i][2], locations[i][3], locations[i][4], locations[i][5]),
        map: map,
        icon : icons[iconCounter],
		shadow: shadow
      });
 
      markers.push(marker);
 
      google.maps.event.addListener(marker, 'click', (function(marker, i) {
        return function() {
          infowindow.setContent(locations[i][0]);
          infowindow.open(map, marker);
        }
      })(marker, i));
 
      iconCounter++;
      // We only have a limited number of possible icon colors, so we may have to restart the counter
      if(iconCounter >= icons_length){
      	iconCounter = 0;
      }
    }
 
    function AutoCenter() {
      //  Create a new viewpoint bound
      var bounds = new google.maps.LatLngBounds();
      //  Go through each...
      $.each(markers, function (index, marker) {
        bounds.extend(marker.position);
      });
      //  Fit these bounds to the map
      map.fitBounds(bounds);
    }
    AutoCenter();
 
 
 
  </script> 
            </div>
        <script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
		<?php
include "includes/footer.php";
?>
    </body>
</html>