Stealthbird97 Posted November 18, 2012 Report Share Posted November 18, 2012 How can I get the Great Circle Mapper Code only show the Pilots flights. <?php $flights = PIREPData::getRecentReportsByCount(5); $string = ""; foreach($flights as $flight) { $string = $string.$flight->depicao.'+-+'.$flight->arricao.',+'; } ?> <img src="http://www.gcmap.com/map?P=<?php echo $string ?>&MS=bm&MR=240&MX=790x400&PM=permr:diamond7:green%2b%22%25I%22:white&PC=%fffff" /><br /> Maps generated by the <a href="http://www.gcmap.com/">Great Circle Mapper</a> It should only show the logged in pilots flights on the map. Thanks in Advance. Quote Link to comment Share on other sites More sharing options...
tutmeister Posted November 18, 2012 Report Share Posted November 18, 2012 Are you saying you only want registered members, who are logged in, to view that map? Or are you saying you want only flights from members who are logged in to be shown on the map? If it's the first, you just wrap an authentication layer around the code: <?php // The user is logged in, so show the map if(Auth::LoggedIn() == true) { ?> <?php $flights = PIREPData::getRecentReportsByCount(5); $string = ""; foreach($flights as $flight) { $string = $string.$flight->depicao.'+-+'.$flight->arricao.',+'; } ?> <img src="http://www.gcmap.com/map?P=<?php echo $string ?>&MS=bm&MR=240&MX=790x400&PM=permr:diamond7:green%2b%22%25I%22:white&PC=%fffff" /> <span>Maps generated by the <a href="http://www.gcmap.com/">Great Circle Mapper</a></span> <?php } //The user is not logged in so don't show anything else { // Do nothing } ?> Quote Link to comment Share on other sites More sharing options...
Stealthbird97 Posted November 19, 2012 Author Report Share Posted November 19, 2012 No, I probably didn't explain properly. Say CVG001 is a pilot. On a his Pilots centre I want it to show all the flights made by that pilot (CVG001). On CVG002's pilot centre i want it to show all the flights made by CVG002. So effectively it only shows the pilots latest flights only not the last flights of the whole airline. If you understand? Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted November 20, 2012 Report Share Posted November 20, 2012 Try this to get the flights for the logged in pilot. This should grab the last 5 flights (depending on the setting of PIREPS_ORDER_BY). $pilotid = AUTH::$userinfo->pilotid; $flights = PIREPData::findPireps(array('u.pilotid'=>$pilotid), 5); Quote Link to comment Share on other sites More sharing options...
Stealthbird97 Posted November 20, 2012 Author Report Share Posted November 20, 2012 Try this to get the flights for the logged in pilot. This should grab the last 5 flights (depending on the setting of PIREPS_ORDER_BY). $pilotid = AUTH::$userinfo->pilotid; $flights = PIREPData::findPireps(array('u.pilotid'=>$pilotid), 5); Works a treat! How would you do the same for each a specific airline, as I have several airlines on one system. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.