Jump to content

Request: Flight Board


CrashGordon

Recommended Posts

So just to confirm.....this has nothing to do with live flights, right?! Just for displaying what would be going on in your schedule if it was really happenning?! Just so I tell my users the correct info. Works good, btw. :)

Nothing to do with reality.:D Just eye candy based on your schedule.

Link to comment
Share on other sites

I just noticed that the times in my board are a bit off. For instance, a flight out of PHNL is showing a departure time that is 3 hours earlier than it should be. So, obviously something is wrong with my schedule or airport details?! When the .tpl file states:

echo '<h3>Expected Departures - Current Time is '.date('G:i').'</h3>';

Where is it getting the date info from? Maybe I need to fix something in my config?!

Link to comment
Share on other sites

  • Administrators

I just noticed that the times in my board are a bit off. For instance, a flight out of PHNL is showing a departure time that is 3 hours earlier than it should be. So, obviously something is wrong with my schedule or airport details?! When the .tpl file states:

echo '<h3>Expected Departures - Current Time is '.date('G:i').'</h3>';

Where is it getting the date info from? Maybe I need to fix something in my config?!

Its your server time.

Link to comment
Share on other sites

There is an issue with bumping the time one hour if it is between 23:00 and 23:59. It appears that data for flights that departed prior to 23:59 gets lost. While this might not be a big problem for departures, if there are long flights involved, arrivals are effected. What happens is while the flight is displayed, the times aren't. I will get a screen shot the next time it occurs. I checked my schedule. There are no enabled flights lacking departure, arrival and flight times. Could it be that the code for "departed" and "arrived", is attempting to pull data from the previous day? Sorry if I can't explain it better.

Link to comment
Share on other sites

  • 2 weeks later...

Hi@all!

I like the Flight board, looks nice. I tried to change the icao names to full names (depicao to depname).

But after this the board didn´t show something in this row. It´s possible to change to airport fullnames? And what should i change.

thx for help.

Andreas

Link to comment
Share on other sites

Hi@all!

I like the Flight board, looks nice. I tried to change the icao names to full names (depicao to depname).

But after this the board didn´t show something in this row. It´s possible to change to airport fullnames? And what should i change.

thx for help.

Andreas

I'm sure it is possible, but I don't have anywhere near enough PHP knowledge to figure out how. I experimented today to see if I could figure it out, but no success. I'm sure someone who actually knows what they are doing, will provide an answer, soon.

Link to comment
Share on other sites

I'm sure it is possible, but I don't have anywhere near enough PHP knowledge to figure out how. I experimented today to see if I could figure it out, but no success. I'm sure someone who actually knows what they are doing, will provide an answer, soon.

Hi Robin, thx for your reply! It´s no problem, i´ll wait for the right code. ;)

Andreas

Link to comment
Share on other sites

  • Administrators

I am not sure what you are using for variables, but if you are basing it off of what I posted a while back you could do ->

$depname = OperationsData::RetrieveAirportInfo($flight->depicao);
$arrname = OperationsData::RetrieveAirportInfo($flight->arricao);

right before your table row within your foreach loop, then change your table cells to ->

<td>'.$depname->name.'</td><td>'.$arrname->name.'</td>

And it will display the name of the airport instead of the icao code.

Link to comment
Share on other sites

I am not sure what you are using for variables, but if you are basing it off of what I posted a while back you could do ->

$depname = OperationsData::RetrieveAirportInfo($flight->depicao);
$arrname = OperationsData::RetrieveAirportInfo($flight->arricao);

right before your table row within your foreach loop, then change your table cells to ->

<td>'.$depname->name.'</td><td>'.$arrname->name.'</td>

And it will display the name of the airport instead of the icao code.

Thx Simpilot for code, i pasted in the template and the dep and arr. rows are empty. Maybe i´ve done a mistake.

Here is the full code with the changes.

$query = "SELECT * FROM phpvms_schedules ORDER BY deptime + 0 ASC";

$list = DB::get_results($query);

echo '<h3>Departures : '.date('d M Y H:i:s T ').' </h3>';

echo '<table width="100%" border="0" bordercolor="#ffffff" bgcolor="#393938"><colgroup>

<col width="40">

<col width="85">

<col width="120">

<col width="120">

<col width="100">

<col width="100">

<col width="130">

</colgroup>';

echo '<tr><td><font color="#fafaf6"><b>Code</b></font></td><td><font color="#fafaf6"><b>Flight Number</b></font></td>

<td><font color="#fafaf6"><b>Departure</b></font></td>

<td><font color="#fafaf6"><b>Arrival</b></font></td><td><font color="#fafaf6"><b>Departure Time</b></font></td>

<td><font color="#fafaf6"><b>Aircraft</b></font></td><td><font color="#fafaf6"><b>Status</b></font></td></tr>';

$count = 0;

$depname = OperationsData::RetrieveAirportInfo($flight->depicao);

$arrname = OperationsData::RetrieveAirportInfo($flight->arricao);

foreach($list as $flight) {

if(date('G:i') >= '23') {

$time = '0';

}

else {

$time = date('G:i');

}

if(($flight->deptime + 0) >= $time) {

if($count < 8) {

$aircraft = OperationsData::getAircraftInfo($flight->aircraft);

echo '<tr><td><font color="#ffff00">'.$flight->code.'</font></td>

<td><font color="#ffff00">'.$flight->flightnum.'</font></td><td><font color="#ffff00">'.$depname->name.'</font></td>

<td><font color="#ffff00">'.$arrname->name.'</font></td><td><font color="#ffff00">'.$flight->deptime.'</font></td>

<td><font color="#ffff00">'.$aircraft->name.'</font></td>';

echo '<td><font color="#ffff00">';

$minutes = explode(':', $flight->deptime);

if($minutes['0'] <= date('G')) {

if(($minutes['1'] - date('i')) <= 0) {

echo 'Departed';

}

elseif(($minutes['1'] - date('i')) <= 5 && ($minutes['1'] - date('i')) >= 5) {

echo 'Final Call';

}

elseif(($minutes['1'] - date('i')) >= 6 && ($minutes['1'] - date('i')) <= 20) {

echo 'Boarding';

}

else {

echo 'Scheduled Departure';

}

}

else {

echo 'Scheduled Departure';

}

echo '</td></tr>';

$count++;

}

}

}

echo '</table>';

:unsure:

Andreas

Link to comment
Share on other sites

  • Administrators

You need to move the

$depname = OperationsData::RetrieveAirportInfo($flight->depicao);
$arrname = OperationsData::RetrieveAirportInfo($flight->arricao);

within the foreach loop

foreach($list as $flight) {
$depname = OperationsData::RetrieveAirportInfo($flight->depicao);
$arrname = OperationsData::RetrieveAirportInfo($flight->arricao);

There is no $flight variable available prior to that.

Link to comment
Share on other sites

  • 3 weeks later...

Times are just a guideline. It won't function if you don't put the departure/arrival times in all of your schedules, as it pulls the flight info from the times depending on what time it is (local database time)

Link to comment
Share on other sites

  • 2 weeks later...

yeah that pastebin gives an invalid paste id now. I'm guessing I got in on this one too late. I have the table on my site but I dont belive mine says departing, landing or what ever it was that got listed before. that is slick to say the least. Mine just says arriving shortly, and in flight I believe. Mine is the basic plane jane version of the table that was released. ;) never altered it at all.

Link to comment
Share on other sites

Hello guys,

I have a question. I have copy an edit the code a little bit. Now I have the problem, that all flight statuts will show next to each user.

What I Mean you can see here

test_pic.JPG

How I can change this? The code is following

<?php 
       date_default_timezone_set('USA/Atlanta');
       $query = "SELECT * FROM phpvms_schedules ORDER BY deptime + 0 ASC";
       $list = DB::get_results($query);
       echo '<h3>Expected Departures - Current Time is '.date('D M j H:i:s T Y').'</h3>';
echo '<table width="90%" border="1">'; 
echo '<tr><td><b>Flight Number</b></td><td><b>Departure</b></td><td><b>Arrival</b></td><td><b>Departure Time</b></td><td><b>Aircraft</b></td><td><b>Status</b></td></tr>'; 
$count = 0; 
foreach($list as $flight) 
{ 
       if(date('G:i') >= '23') 
       {$time = '0';} 
       else 
       {$time = date('G:i');} 
               if(($flight->deptime + 0) > $time) 
               { 
       if($count < 10) 
       { 
               $aircraft = OperationsData::getAircraftInfo($flight->aircraft); 
               echo '<tr><td>'.$flight->code.$flight->flightnum.'</td><td>'.$flight->depicao.'</td><td>'.$flight->arricao.'</td><td>'.$flight->deptime.'</td><td>'.$aircraft->fullname.'</td>'; 
               echo '<td>'; 
               if(($flight->deptime - date('G:i')) <= 2 / 120 * 1) 
               { 
               echo 'Departed'; 
               } 				

               if(($flight->deptime - date('G:i')) <= 2 / 120 * 5) 
               { 
               echo 'Gate closed'; 
               } 				

               if(($flight->deptime - date('G:i')) <= 2 / 120 * 15) 
               { 
               echo 'Final Call'; 
               } 

               if(($flight->deptime - date('G:i')) <= 2 / 120 * 30) 
               { 
               echo 'Boarding'; 
               } 

               if(($flight->deptime - date('G:i')) <= 2) 
               { 
               echo 'Check-In open'; 
               } 

  else
               { 
               echo ''; 
               } 
               echo '</td></tr>'; 
               $count++; 
       } 
       } 
} 
echo '</table>';

echo '<h3>Expected Arrivals - Current Time is '.date('G:i').'</h3>'; 
echo '<table width="90%" border="1">'; 
echo '<tr><td><b>Flight Number</b></td><td><b>Departure</b></td><td><b>Arrival</b></td><td><b>Arrival Time</b></td><td><b>Aircraft</b></td><td><b>Status</b></td></tr>'; 
$count = 0; 
foreach($list as $flight) 
{ 
       if(date('G:i') >= '23') 
       {$time = '0';} 
       else 
       {$time = date('G:i');} 
               if(($flight->arrtime + 0) > $time) 
               { 
       if($count < 10) 
       { 
               $aircraft = OperationsData::getAircraftInfo($flight->aircraft); 
               echo '<tr><td>'.$flight->code.$flight->flightnum.'</td><td>'.$flight->depicao.'</td><td>'.$flight->arricao.'</td><td>'.$flight->arrtime.'</td><td>'.$aircraft->fullname.'</td>'; 
               echo '<td>';
                if(($flight->arrtime - date('G:i')) <= 1 / 60 * 1) 
               { 
               echo 'Landed'; 
               }

               if(($flight->arrtime - date('G:i')) <= 1 / 60 * 15) 
               { 
               echo 'On Approach'; 
               } 
               else 
               { 
               echo 'On Time'; 
               } 
               echo '</td></tr>'; 
               $count++; 
       } 
       } 
} 
echo '</table>';  
?>

Who can help me please?

Regards

Olaf

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