Jump to content

Recommended Posts

Posted

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

Posted

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;

  • Like 1
Posted

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.

Posted

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.

  • Like 1
Posted

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.

Posted

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 />';
?>

Posted

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.

Posted

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.

  • Moderators
Posted

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; ?>

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