Guest lorathon Posted July 22, 2010 Report Share Posted July 22, 2010 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> Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted July 22, 2010 Moderators Report Share Posted July 22, 2010 Thanks! It worked like a charm! Quote Link to comment Share on other sites More sharing options...
Jeff Posted July 22, 2010 Report Share Posted July 22, 2010 (edited) 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 July 22, 2010 by Jeff Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted July 22, 2010 Moderators Report Share Posted July 22, 2010 hey jeff, i did try that but it did not show nothing, what am i doing wrong? Quote Link to comment Share on other sites More sharing options...
Jeff Posted July 22, 2010 Report Share Posted July 22, 2010 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> Quote Link to comment Share on other sites More sharing options...
Jeff Posted July 22, 2010 Report Share Posted July 22, 2010 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>"; } ?> 3 Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted July 22, 2010 Moderators Report Share Posted July 22, 2010 THANKS JEFF!!!! Now i have to fix it up of the <div>'s. Thanks JEFF! You are awsome! One point! 1 Quote Link to comment Share on other sites More sharing options...
MrAmsterdam Posted July 23, 2010 Report Share Posted July 23, 2010 damn, this is a sweet addon!! Quote Link to comment Share on other sites More sharing options...
TAV1702 Posted July 24, 2010 Report Share Posted July 24, 2010 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. 1 Quote Link to comment Share on other sites More sharing options...
Gabriel Fernandez Posted August 9, 2010 Report Share Posted August 9, 2010 very nice, work very good Quote Link to comment Share on other sites More sharing options...
Nout - Zon Executive Posted September 24, 2010 Report Share Posted September 24, 2010 very nice, work very good How would it be able to alter the code so it simply shows ALL routes in your database? Quote Link to comment Share on other sites More sharing options...
Daniel Posted February 3, 2011 Report Share Posted February 3, 2011 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 Quote Link to comment Share on other sites More sharing options...
Daniel Posted February 3, 2011 Report Share Posted February 3, 2011 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 Quote Link to comment Share on other sites More sharing options...
Rafael Posted February 8, 2011 Report Share Posted February 8, 2011 The map does not appear. If I add the ICAO airport manually until it works, but not automatic updates. Quote Link to comment Share on other sites More sharing options...
Tom Posted February 8, 2011 Report Share Posted February 8, 2011 You can't put php in pages from the admin panel. Quote Link to comment Share on other sites More sharing options...
Rafael Posted February 8, 2011 Report Share Posted February 8, 2011 I have to put where? Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted February 8, 2011 Moderators Report Share Posted February 8, 2011 Create the page as you have in the admin panel but blank, then edit the page manually using your ftp client. Quote Link to comment Share on other sites More sharing options...
Rafael Posted February 8, 2011 Report Share Posted February 8, 2011 Does anyone have the HTML of the last flights of the "Pilot" and the flights booked? Quote Link to comment Share on other sites More sharing options...
Thomas Rozanov Posted February 10, 2011 Report Share Posted February 10, 2011 The map does not appear. If I add the ICAO airport manually until it works, but not automatic updates. Rafael I told you the exact same thing. http://forum.phpvms.net/topic/4448-last-flights-map/page__p__29558#entry29558 Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted February 10, 2011 Report Share Posted February 10, 2011 Put the code directly into the frontpage_main.tpl Quote Link to comment Share on other sites More sharing options...
Jeff Posted April 4, 2011 Report Share Posted April 4, 2011 Kyle, you wouldn't by chance have the coed to show the map for all flights in the database do you? I need to place a map that shows all the flights I have scheduled. Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted April 4, 2011 Moderators Report Share Posted April 4, 2011 Jeff there is a limit to the amount of routes you can show, i dont think you can show them all. Mind you sating that my ops guy has managed to get all flights from a hub displayed so maybe its possible, Quote Link to comment Share on other sites More sharing options...
Jeff Posted April 4, 2011 Report Share Posted April 4, 2011 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. 1 Quote Link to comment Share on other sites More sharing options...
Jeff Posted April 9, 2011 Report Share Posted April 9, 2011 Kind Bump... Anyone: help with a code to show a map of all flights available for Aircraft Registration? 1 Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted April 10, 2011 Report Share Posted April 10, 2011 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 Quote Link to comment Share on other sites More sharing options...
Industrialshadow Posted April 29, 2011 Report Share Posted April 29, 2011 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> Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted April 29, 2011 Moderators Report Share Posted April 29, 2011 I think some of the variables have been renamed, but the old ones still work, check out the changes below, https://github.com/nshahzad/phpVMS/issues/38 This may be relevant, For PIREPs: $pirep - A single PIREP $pirep_list - A list of PIREPs Quote Link to comment Share on other sites More sharing options...
Industrialshadow Posted April 30, 2011 Report Share Posted April 30, 2011 have you an complet code working? I dont know what i must change to solve the failure thanks Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted April 30, 2011 Moderators Report Share Posted April 30, 2011 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 Quote Link to comment Share on other sites More sharing options...
Industrialshadow Posted April 30, 2011 Report Share Posted April 30, 2011 Hi mark Thanks a lot for help. I have change the code doenst work. I think nabeel have a idea or the original coder? I will wait for you....At the moment i can live with that problem cheers 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.