Jump to content

Map Markers


smokey68

Recommended Posts

  • Moderators

It can be done. You should edit the lib/js/acarsmap.js file of your phpVMS system. Also, a good start would be to use the OperationsData::getAllHubs() function. It already exists within your phpVMS system. Develop a php foreach using the data returned from that function and add the hub marker within the foreach. Use it as a start and let us know if you get stuck anywhere.

Link to comment
Share on other sites

13 hours ago, servetas said:

It can be done. You should edit the lib/js/acarsmap.js file of your phpVMS system. Also, a good start would be to use the OperationsData::getAllHubs() function. It already exists within your phpVMS system. Develop a php foreach using the data returned from that function and add the hub marker within the foreach. Use it as a start and let us know if you get stuck anywhere.

<?php 

foreach $OperationsData::getAllHubs()
{ 

        var myLatLng = {lat: $hub->deplat, lng: $hub->deplng };

        var map = new google.maps.Map(document.getElementById('map'), {
          zoom: 4,
          center: myLatLng
        });

        var marker = new google.maps.Marker({
          position: myLatLng,
          map: map,
          title: 'Airport ID'
        });

}?>

Does this look right ?

Link to comment
Share on other sites

Try this

<script type="text/javascript">
<?php
$allhubs = OperationsData::getAllHubs();
foreach($allhubs as $hub) {
?>

var hubLatLng = {lat: <?php echo $hub->lat; ?>, lng: <?php echo $hub->lng; ?> };

var marker = new google.maps.Marker({
  position: hubLatLng,
  map: map,
  title: "<?php echo $hub->icao; ?>" + " - " + "<?php echo $hub->name; ?>"
});

<?php
}
?>
</script>

Put it in acarsmap.php at the very end of the file.

You can't mix javascript and PHP like you have done as it will fail to work.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...