Jump to content

Recommended Posts

Posted

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.

Posted

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
} 
?>

Posted

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?

Guest lorathon
Posted

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);

Posted

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.

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...