I am currently in the proccess of creating a new flight map that looks cleaner and nicer than the google one. It even automatically resizes just to show the routes that have been flown. To use it, I need to find a way to make a list of DEPICAO-ARRICAO,DEPICAO-ARRICAO,DEPICAO-ARRICAO,DEPICAO-ARRICAO.
Example: KTPA-KMCO,KMCO-KMHT,KMHT-KMDW,KMDW-KLAS
Then, I need to insert that info into an image tag.
Sorry to sound so needy, but I have two more questions. (I’ve read the API guide but I still can’t figure these things out on my own. Any ideas on places I can look to learn?)
Question 1: How can I implement a similar code on the homepage, but instead, display the info in the same map format for the last 20 accepted (or preferably, accepted PIREPs in the past XX days) PIREPS on my website?
Question 2: How can I implement a similar code on the PIREP Details Route_Map template, but instead, display the info in the same map format for the dep. and arr. ICAO associated to that PIREP?
sounds good what you do there.. if possible, could you make it to work for me, that a map is shown in the flight briefing section? then i could handover it to my crew briefing script
Question 1: How can I implement a similar code on the homepage, but instead, display the info in the same map format for the last 20 accepted (or preferably, accepted PIREPs in the past XX days) PIREPS on my website?
By count
<?php
$pireps = PIREPData::getRecentReportsByCount('20'); //20 = # of records
foreach($pireps as $pirep)
{
echo $pirep->depicao.'-'.$pirep->arricao.',';
}
?>
By days
<?php
$pireps = PIREPData::getRecentReports('2'); // 2 = # of days
foreach($pireps as $pirep)
{
echo $pirep->depicao.'-'.$pirep->arricao.',';
}
?>
Question 2: How can I implement a similar code on the PIREP Details Route_Map template, but instead, display the info in the same map format for the dep. and arr. ICAO associated to that PIREP?
not sure what you mean here… the pirep route map shows the dep and arr already…
Thanks a TON! I don’t even know how I can thank you enough.
As for #2, on the homepage, there are the 3 most recent PIREPs. If you click on one of the flight numbers, you see more details about the flight. At the bottom, it shows a route map. How can I get the code to display the dep ICAO-arr ICAO of the PIREP. Thanks!
Thanks a TON! I don’t even know how I can thank you enough.
As for #2, on the homepage, there are the 3 most recent PIREPs. If you click on one of the flight numbers, you see more details about the flight. At the bottom, it shows a route map. How can I get the code to display the dep ICAO-arr ICAO of the PIREP. Thanks!
Carl Klinker
If you look around in the rest of the template, it’s probably there somewhere. IIRC, it’s
I think what you are looking for shows up in the route_map.tpl view. The data for the map is being passed to that view using one of two variables depending on where the map is displayed, ($pirep or $schedule) $pirep is being used when looking at the flight details accessed from the frontpage. You should be able to get the data off that page with $pirep->arricao and $pirep->depicao. If you are trying to get the data from the db and use it in your own page you should use
$mydata = PIREPData::getReportDetails($pirepid);
The $priepid id the db id # of the prirep you are trying to get data for. Once you have that you can do a
print_r($mydata);
to see all the fields that are available, which are a ton including the aircraft data, airfields, pilot, etc…
<?php
$pireps = PIREPData::getRecentReportsByCount('20'); //20 = # of records
foreach($pireps as $pirep)
{
echo $pirep->depicao.'-'.$pirep->arricao.',';
}
?>
but, how can I get it to actually draw the lines on the map instead of it just showing the ICAO’s under the map? Can you give me a step-by-step process for this please? This is on my home page of my site. click my badge to go there.
But Jeff, how do you get the lines to show ON the map? It just shows a blank map with the flights listed in text underneath?! What is the point of the map?!
Actually, wait…you are asking for that same thing, aren’t you? Sorry.
But Jeff, how do you get the lines to show ON the map? It just shows a blank map with the flights listed in text underneath?! What is the point of the map?!
That’s what I was asking 3 posts up. I’d like to know how to get them to show the lines, because all it is showing is the ICAO codes with a blank map.
Sorry, but…what would I change to add an individual’s map to their profile(profile_main.tpl) page? I want to show THEIR last number of flights there as well.
I have used the code from the previous page and implemented it in the pilot_public_profile.tpl so it displays the map of pilots flights. But I am struggling with a problem, namely when the pilot has not flown any flights just over the blank map image, the error message pop up:
Warning: Invalid argument supplied for foreach() in …/pilot_public_profile.tpl on line 102
I have tried playing with a if function, but it doesnt work for me, or maybe I did it in wrong way.
And one more thing, how do I make it to get the values of last 10 flights? Because in the original code from the previous page, there was such a line of code