Jump to content

GCMap - Great Circle Mapper


Guest lorathon

Recommended Posts

Guest lorathon

This will display the last 10 flights in a GCMap

Great Circle Mapper

Visit this site to customize the display of the map.

<?php
$flights = PIREPData::getRecentReportsByCount(10);									
$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=650x360&PM=pemr:diamond7:red%2b%22%25I%22:red&PC=%230000ff" /><br />
             Maps generated by the <a href="http://www.gcmap.com/">Great Circle Mapper</a> - copyright © <a href="http://www.kls2.com/~karl/">Karl L. Swartz</a>

Link to comment
Share on other sites

Use this to get the table to sit under it if you like:

<?php
$count = 10;
$pireps = PIREPData::getRecentReportsByCount($count);
?>

<table width="100%" border="0" bordercolor="#FFFFFF">
  <thead>
    <tr align="center" valign="middle" bgcolor="#7D95AF">
      <th>Flight #</th>
      <th>Departure</th>
      <th>Arrival</th>
      <th>Duration</th>
      <th>Pilot</th>
      <th>Landing Rate</th>
      <th>Aircraft</th>
    </tr>

You can change the colors, table width, and table count to suit your needs as well.

That code was posted by Jeff (Lorathon) earlier in another post, just tweaked it a bit.
Edited by Jeff
Link to comment
Share on other sites

Here is how I have it on my site.

<table>
         <tr>
           <th>LAST 15 FLIGHT LEGS</th>
         </tr>
         <tr>
           <td><p align="center"><img src="http://www.gcmap.com/map?P=<?php echo $string ?>&MS=bm&MR=240&MX=650x360&PM=pemr:diamond7:red%2b%22%25I%22:red&PC=%230000ff" /><br />

             </tr>
                   </table>
                   <?php
$count = 15;
$pireps = PIREPData::getRecentReportsByCount($count);
?>

<table width="94%" border="0" bordercolor="#FFFFFF">
  <thead>
    <tr align="center" valign="middle" bgcolor="#7D95AF">
      <th>Flight #</th>
      <th>Departure</th>
      <th>Arrival</th>
      <th>Duration</th>
      <th>Pilot</th>
      <th>Landing Rate</th>
      <th>Aircraft</th>
    </tr>
   </thead>
   <tbody>

Link to comment
Share on other sites

s***, sorry... I didn't give you the whole code...

<?php
$count = 15;
$pireps = PIREPData::getRecentReportsByCount($count);
?>

<table width="94%" border="0" bordercolor="#FFFFFF">
  <thead>
    <tr align="center" valign="middle" bgcolor="#7D95AF">
      <th>Flight #</th>
      <th>Departure</th>
      <th>Arrival</th>
      <th>Duration</th>
      <th>Pilot</th>
      <th>Landing Rate</th>
      <th>Aircraft</th>
    </tr>
   </thead>
   <tbody>

<?php

if(count($pireps) > 0)
{
 foreach ($pireps as $pirep)
 {
   $pilotinfo = PilotData::getPilotData($pirep->pilotid);
   $pilotid = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid); 

   echo "<tr>";
   echo "<td align=center> $pirep->code $pirep->flightnum </td>";
   echo "<td align=center> $pirep->depicao </td>";
   echo "<td align=center> $pirep->arricao </td>";
   echo "<td align=center> $pirep->flighttime </td>";
   echo "<td align=center> $pilotid $pilotinfo->firstname $pilotinfo->lastname </td>";
   echo "<td align=center> $pirep->landingrate </td>";
   echo "<td align=center> $pirep->aircraft </td>";
   echo "</tr>";
 }
}
else
{
   echo "<tr><td>There are no recent flights!</td></tr>";
}
?>

  • Like 3
Link to comment
Share on other sites

Just for the hell of doing it, I made this into a module. Here lyes the problem. How would I go about calling the module to show up on my page? I have tried everything I can think of and it will not come up. I know the module file is good and so is my tpl, the problem has to be the way that I am calling it.

My module name is GCmap

And Jeff, thanks for posting your code. I used it in the module. This was nothing that was a release candidate or anything, it was just because I was messing around killing time. I just figured I would add the disclaimer that I used your code. ;)

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...
  • 4 months later...

s***, sorry... I didn't give you the whole code...

<?php
$count = 15;
$pireps = PIREPData::getRecentReportsByCount($count);
?>

<table width="94%" border="0" bordercolor="#FFFFFF">
  <thead>
    <tr align="center" valign="middle" bgcolor="#7D95AF">
      <th>Flight #</th>
      <th>Departure</th>
      <th>Arrival</th>
      <th>Duration</th>
      <th>Pilot</th>
      <th>Landing Rate</th>
      <th>Aircraft</th>
    </tr>
   </thead>
   <tbody>

<?php

if(count($pireps) > 0)
{
 foreach ($pireps as $pirep)
 {
   $pilotinfo = PilotData::getPilotData($pirep->pilotid);
   $pilotid = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid); 

   echo "<tr>";
   echo "<td align=center> $pirep->code $pirep->flightnum </td>";
   echo "<td align=center> $pirep->depicao </td>";
   echo "<td align=center> $pirep->arricao </td>";
   echo "<td align=center> $pirep->flighttime </td>";
   echo "<td align=center> $pilotid $pilotinfo->firstname $pilotinfo->lastname </td>";
   echo "<td align=center> $pirep->landingrate </td>";
   echo "<td align=center> $pirep->aircraft </td>";
   echo "</tr>";
 }
}
else
{
   echo "<tr><td>There are no recent flights!</td></tr>";
}
?>

Hey Jeff Just wondering if possible you could help me put in there if it si accepted, pending or rejected. I tried doing it but it didn't work...

I was using this.

<?php

	if($report->accepted == PIREP_ACCEPTED)

		echo '<div id="success">Accepted</div>';

	elseif($report->accepted == PIREP_REJECTED)

		echo '<div id="error">Rejected</div>';

	elseif($report->accepted == PIREP_PENDING)

		echo '<div id="pending">Approval Pending</div>';

	elseif($report->accepted == PIREP_INPROGRESS)

		echo '<div id="error">Flight in Progress</div>';

	?>

Thanks

Link to comment
Share on other sites

Hey Jeff Just wondering if possible you could help me put in there if it si accepted, pending or rejected. I tried doing it but it didn't work...

I was using this.

<?php

	if($report->accepted == PIREP_ACCEPTED)

		echo '<div id="success">Accepted</div>';

	elseif($report->accepted == PIREP_REJECTED)

		echo '<div id="error">Rejected</div>';

	elseif($report->accepted == PIREP_PENDING)

		echo '<div id="pending">Approval Pending</div>';

	elseif($report->accepted == PIREP_INPROGRESS)

		echo '<div id="error">Flight in Progress</div>';

	?>

Thanks

Found It!

here it is if anyone else want's it

http://forum.phpvms.net/topic/3291-recent-5-flights/page__st__20

Thanks

Link to comment
Share on other sites

  • 1 month later...

Thanks Mark....how about just by Airline then. I don't think it would be too overloaded by just one airline. Since I am using multiple airlines to fly with on my server. Or better yet, by Aircraft Registration...that would better suit my needs more than the whole flight database.

  • Like 1
Link to comment
Share on other sites

Guest lorathon

You should be able to get the schedules for an aircraft registration as such

$registration = '123456';  //Put the aircraft registration number into here.  This shows hardcoded
$registration = $this->get->registration //from the url (http://www.mysite/index.php/MODULE/FUNCTION?registration=123456
$registration = $this->post->registration //from form <input type="text" name="registration" />

$schedules = SchedulesData::findSchedules(array('a.registration' => $registration));

Use the $schedules to loop through for the map.

NOT TESTED but should work

Link to comment
Share on other sites

  • 3 weeks later...

Hello after update to the newest version i become a failuer

Warning: Invalid argument supplied for foreach() in /www/htdocs/w00dac26/SF/lib/skins/ObsessBlue/frontpage_main.tpl on line 24

this is my main.tpl

<div class="mc0201">
     <p>Welcome to SF Logistik</p>
     <p>We look forward to the pages of Sf welcome logistics may be. Look around and discover the life of a pilot. Our mission is to transport cargo quickly and safely to their destination. We rely on our well-trained pilots.</p>
     <p></p>
     <p></p>
     <p></p>
     <p></p>
        </div>
                <br />
                 <br />
                <div class="mc020303">
<?php

       // Show the News module, call the function ShowNewsFront
       //      This is in the modules/Frontpage folder

       MainController::Run('FrontBids', 'RecentFrontPage', 15);
       Template::Show('acarsmap.tpl');
?>
<p></p>
<?php
       $flights = PIREPData::getRecentReportsByCount(10);                                                                      
       $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=650x360&PM=pemr:diamond7:red%2b%22%25I%22:red&PC=%230000ff" /><br />
             Maps generated by the <a href="http://www.gcmap.com/">Great Circle Mapper</a> - copyright © <a href="http://www.kls2.com/~karl/">Karl L. Swartz</a>

</div>
<div class="mc020303">

</div>

Link to comment
Share on other sites

  • Moderators

Hi, I have not updated yet to the latest beta because of the issues that i may experience and have to overcome.

Try changing,

$flights = PIREPData::getRecentReportsByCount(10);

to

$flights = $pirep_list::getRecentReportsByCount(10);

I dont know till i sit down later and have a look, that might be complete garbage :)

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