Guest lorathon Posted July 22, 2010 Report 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
Moderators Kyle Posted July 22, 2010 Moderators Report Posted July 22, 2010 Thanks! It worked like a charm! Quote
Jeff Posted July 22, 2010 Report 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
Moderators Kyle Posted July 22, 2010 Moderators Report Posted July 22, 2010 hey jeff, i did try that but it did not show nothing, what am i doing wrong? Quote
Jeff Posted July 22, 2010 Report 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
Jeff Posted July 22, 2010 Report 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
Moderators Kyle Posted July 22, 2010 Moderators Report 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
TAV1702 Posted July 24, 2010 Report 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
Nout - Zon Executive Posted September 24, 2010 Report 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
Daniel Posted February 3, 2011 Report 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
Daniel Posted February 3, 2011 Report 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
Rafael Posted February 8, 2011 Report Posted February 8, 2011 The map does not appear. If I add the ICAO airport manually until it works, but not automatic updates. Quote
Tom Posted February 8, 2011 Report Posted February 8, 2011 You can't put php in pages from the admin panel. Quote
Moderators mark1million Posted February 8, 2011 Moderators Report 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
Rafael Posted February 8, 2011 Report Posted February 8, 2011 Does anyone have the HTML of the last flights of the "Pilot" and the flights booked? Quote
Thomas Rozanov Posted February 10, 2011 Report 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
Guest lorathon Posted February 10, 2011 Report Posted February 10, 2011 Put the code directly into the frontpage_main.tpl Quote
Jeff Posted April 4, 2011 Report 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
Moderators mark1million Posted April 4, 2011 Moderators Report 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
Jeff Posted April 4, 2011 Report 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
Jeff Posted April 9, 2011 Report Posted April 9, 2011 Kind Bump... Anyone: help with a code to show a map of all flights available for Aircraft Registration? 1 Quote
Guest lorathon Posted April 10, 2011 Report 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
Industrialshadow Posted April 29, 2011 Report 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
Moderators mark1million Posted April 29, 2011 Moderators Report 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
Industrialshadow Posted April 30, 2011 Report Posted April 30, 2011 have you an complet code working? I dont know what i must change to solve the failure thanks Quote
Moderators mark1million Posted April 30, 2011 Moderators Report 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
Industrialshadow Posted April 30, 2011 Report 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
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.