alpsJet Posted May 4, 2014 Report Share Posted May 4, 2014 Hello, I am looking for the aircraft registration, the flight number without the IATA Code, the departure hour, departure minute, arrival hour, arrival minute and the route on the briefing page. Does someone have this codes? Greetings Julius Quote Link to comment Share on other sites More sharing options...
freshJet Posted May 4, 2014 Report Share Posted May 4, 2014 Registration, flight number and route are easy: <?php echo $schedule->registration;?> <?php echo $schedule->flightnum;?> <?php echo $schedule->route;?> Splitting up the times is a bit more tricky. This will only work if your times are in the HH:MM format, not HHMM. <?php $deptime = str_replace(':', '', $schedule->deptime); $arrtime = str_replace(':', '', $schedule->arrtime); $dephour = substr($deptime, -2); $depmin = substr($deptime, 2); $arrhour = substr($arrtime, -2); $arrmin = substr($arrtime, 2); echo $dephour; echo $depmin; echo $arrhour; echo $arrmin; 1 Quote Link to comment Share on other sites More sharing options...
alpsJet Posted May 4, 2014 Author Report Share Posted May 4, 2014 Thank you very much! Quote Link to comment Share on other sites More sharing options...
alpsJet Posted May 4, 2014 Author Report Share Posted May 4, 2014 I also need the icao code. I am sorry PHP is not my best I am better in HTML/CSS Quote Link to comment Share on other sites More sharing options...
alpsJet Posted May 4, 2014 Author Report Share Posted May 4, 2014 And the code for the time does not work. If I have a departure time of 11:20 and an arrival time of 12:30 he gives me 20 as departure hour and also 20 as departure minute and 30 as arrival hour and also 30 as arrival minute. Quote Link to comment Share on other sites More sharing options...
freshJet Posted May 4, 2014 Report Share Posted May 4, 2014 Sorry the times should be: <?php $deptime = str_replace(':', '', $schedule->deptime); $arrtime = str_replace(':', '', $schedule->arrtime); $dephour = substr($deptime, 0, 5); $depmin = substr($deptime, -2); $arrhour = substr($arrtime, 0, 5); $arrmin = substr($arrtime, -2); echo $dephour; echo $depmin; echo $arrhour; echo $arrmin; ?> The ICAO is $schedule->depicao and $schedule->arricao. 1 Quote Link to comment Share on other sites More sharing options...
alpsJet Posted May 4, 2014 Author Report Share Posted May 4, 2014 Thank you very much for the times! But I am sorry for missunderstooding. I meant the aircraft ICAO Codes. So for Example B738, MD82 or DH8D. Quote Link to comment Share on other sites More sharing options...
freshJet Posted May 5, 2014 Report Share Posted May 5, 2014 $schedule->aircrafticao; I think Quote Link to comment Share on other sites More sharing options...
alpsJet Posted May 5, 2014 Author Report Share Posted May 5, 2014 Thank you! Quote Link to comment Share on other sites More sharing options...
alpsJet Posted May 5, 2014 Author Report Share Posted May 5, 2014 I am sorry but the registration does not work. And the dep hour and arrival hour is still 1120 or 1230 but the arrival minute and hour is correct. Quote Link to comment Share on other sites More sharing options...
alpsJet Posted May 7, 2014 Author Report Share Posted May 7, 2014 Nobody an idea? Quote Link to comment Share on other sites More sharing options...
Tom Posted May 9, 2014 Report Share Posted May 9, 2014 Perhaps try: $deptime = explode(":", $schedule->deptime); $arrtime = explode(":", $schedule->arrtime); // Use where you require as follows $arrtime[0] // Hours $arrtime[1] // Minutes I'm sort of guessing though without investigating it all properly. Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted May 9, 2014 Moderators Report Share Posted May 9, 2014 Why do you want to split the departing and arriving hours in hours and minutes? Quote Link to comment Share on other sites More sharing options...
alpsJet Posted May 10, 2014 Author Report Share Posted May 10, 2014 I need it for the simBrief API. There it is required to split the times. Ok and thanks I will try. Quote Link to comment Share on other sites More sharing options...
freshJet Posted May 10, 2014 Report Share Posted May 10, 2014 This works <?php $deptime = str_replace(':', '', $schedule->deptime); $arrtime = str_replace(':', '', $schedule->arrtime); $dephour = substr($deptime, 0, 2); $depmin = substr($deptime, -2); $arrhour = substr($arrtime, 0, 2); $arrmin = substr($arrtime, -2); echo $dephour.' <br />'; echo $depmin.' <br />'; echo $arrhour.' <br />'; echo $arrmin.' <br />'; ?> Quote Link to comment Share on other sites More sharing options...
alpsJet Posted May 10, 2014 Author Report Share Posted May 10, 2014 Okay thanks! The times are working. Thanks so much! Now I only need the ICAO Code. I tried different things but nothing worked for me. Quote Link to comment Share on other sites More sharing options...
alpsJet Posted May 13, 2014 Author Report Share Posted May 13, 2014 If anyone is interested for the ICAO Code. I set the following code <?php if ("McDonnell Douglas MD-82") { echo "MD82"; } ?> You have to repeat it for every aircraft type. I did not tried it out completely but I think it will work. Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted May 13, 2014 Moderators Report Share Posted May 13, 2014 Doesn't this work? <?php echo $schedule->aircraft; ?> Quote Link to comment Share on other sites More sharing options...
alpsJet Posted May 13, 2014 Author Report Share Posted May 13, 2014 Yeah it will work, but I'll get then the name. But I need the ICAO Code. And the Code up there is wrong, but the PC is shutted down and I can not upload it currently. I think I will do i tomorrow. Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted May 13, 2014 Moderators Report Share Posted May 13, 2014 Ok, i have found out what you have to do. Open your SchedulesData.class.php file and find this: $sql = 'SELECT s.*, a.id as aircraftid, a.name as aircraft, a.registration, a.minrank as aircraft_minrank, a.ranklevel as aircraftlevel, dep.name as depname, dep.lat AS deplat, dep.lng AS deplng, arr.name as arrname, arr.lat AS arrlat, arr.lng AS arrlng FROM '.TABLE_PREFIX.'schedules AS s LEFT JOIN '.TABLE_PREFIX.'airports AS dep ON dep.icao = s.depicao LEFT JOIN '.TABLE_PREFIX.'airports AS arr ON arr.icao = s.arricao LEFT JOIN '.TABLE_PREFIX.'aircraft AS a ON a.id = s.aircraft '; Replace the above part of code with this one: $sql = 'SELECT s.*, a.id as aircraftid, a.name as aircraft, a.icao as aircrafticao, a.registration, a.minrank as aircraft_minrank, a.ranklevel as aircraftlevel, dep.name as depname, dep.lat AS deplat, dep.lng AS deplng, arr.name as arrname, arr.lat AS arrlat, arr.lng AS arrlng FROM '.TABLE_PREFIX.'schedules AS s LEFT JOIN '.TABLE_PREFIX.'airports AS dep ON dep.icao = s.depicao LEFT JOIN '.TABLE_PREFIX.'airports AS arr ON arr.icao = s.arricao LEFT JOIN '.TABLE_PREFIX.'aircraft AS a ON a.id = s.aircraft '; After that you can use the following part of code in order to "call" the aircraft icao code: <?php echo $schedule->aircrafticao; ?> Quote Link to comment Share on other sites More sharing options...
alpsJet Posted May 14, 2014 Author Report Share Posted May 14, 2014 Thanks very much it works! 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.