Jump to content

Getting some values on briefing page


alpsJet

Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • Moderators

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

Link to comment
Share on other sites

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